<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/taglibs.jsp"%>

<form action="${ctx}/sys/acl/add" method="post">
    <table>
        <tbody>
            <tr>
                <td><label for="addform-id">访问控制ID</label></td>
                <td><input type="text" id="addform-id" name="id" class="easyui-textbox"
                        data-options="validType:'length[0,32]', prompt:'不输入时会自动生成'"/>
                </td>
            </tr>
            <tr>
                <td><label for="addform-principalType">主体类型</label></td>
                <td><input type="text" id="addform-principalType" name="principalType" class="easyui-textbox"
                        data-options="required:true"/>
                </td>
            </tr>
            <tr>
                <td><label for="addform-principalId">主体ID</label></td>
                <td><input type="text" id="addform-principalId" name="principalId" class="easyui-textbox"
                        data-options="required:true"/>
                </td>
            </tr>
            <tr>
                <td><label for="addform-resourceType">资源类型</label></td>
                <td><input type="text" id="addform-resourceType" name="resourceType" class="easyui-textbox"
                        data-options="required:true"/>
                </td>
            </tr>
            <tr>
                <td><label for="addform-resourceGroup">资源组</label></td>
                <td><input type="text" id="addform-resourceGroup" name="resourceGroup" class="easyui-textbox"
                        data-options="required:true"/>
                </td>
            </tr>
            <tr>
                <td><label for="addform-aclCode">访问控制码</label></td>
                <td><input type="text" id="addform-aclCode" name="aclCode" class="easyui-textbox"
                        data-options="required:true, validType:'number'"/>
                </td>
            </tr>
        </tbody>
    </table>
</form>

<script type="text/javascript">
$(function(){
    var $principalType = $('#addform-principalType');
    var $resourceType = $('#addform-resourceType');
    $principalType.combogrid({
        url: ctx + '/sys/dict/list-by-field',
        queryParams: {
            field: 'principal_type',
        },
        idField: 'value',
        textField: 'valueDesc',
        rownumbers: true,
        fitColumns: true,
        columns: [[
            {title: '主体类型', field: 'value', sortable: true, width: 100},
            {title: '类型描述', field: 'valueDesc', sortable: true, width: 100}
        ]]
    });
    $resourceType.combogrid({
        url: ctx + '/sys/dict/list-by-field',
        queryParams: {
            field: 'resource_type',
        },
        idField: 'value',
        textField: 'valueDesc',
        rownumbers: true,
        fitColumns: true,
        columns: [[
            {title: '资源类型', field: 'value', sortable: true, width: 100},
            {title: '类型描述', field: 'valueDesc', sortable: true, width: 100}
        ]]
    })
});
</script>
